gusucode.com > VC++ 信息加密聊天源代码-源码程序 > VC++ 信息加密聊天源代码-源码程序\code\SecChat\SecretChat.cpp
//Download by http://www.NewXing.com // SecretChat.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "SecretChat.h" #include "SecretChatDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CSecretChatApp BEGIN_MESSAGE_MAP(CSecretChatApp, CWinApp) //{{AFX_MSG_MAP(CSecretChatApp) //}}AFX_MSG ON_COMMAND(ID_HELP, CWinApp::OnHelp) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSecretChatApp construction CSecretChatApp::CSecretChatApp() { } ///////////////////////////////////////////////////////////////////////////// // The one and only CSecretChatApp object CSecretChatApp theApp; ///////////////////////////////////////////////////////////////////////////// // CSecretChatApp initialization BOOL CSecretChatApp::InitInstance() { //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ if( ::GlobalFindAtom("MyTimer")/*查找标记*/ == 0) m_ATOM = ::GlobalAddAtom("MyTimer");//添加标记 else { //询问是否还有打开另一个实例 if(MessageBox( NULL, "已经有实例运行中,是否继续?", "密聊", MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDNO) { return FALSE; } } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SetRegistryKey(_T("文件密使")); //设定注册表 if (!AfxSocketInit()) { AfxMessageBox(IDP_SOCKETS_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); // Standard initialization #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif CSecretChatDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { } else if (nResponse == IDCANCEL) { } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; } int CSecretChatApp::ExitInstance() { //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ::GlobalDeleteAtom( m_ATOM); //删除标记 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% return CWinApp::ExitInstance(); }